<?php

class Wzx {
	// This class is the core file of wzx.com,don't try to rewrite this.
    // This is an array of arrays that specify the modules using facekoo global module ID
    // A module specifies collections of applications, space page component, main page, and 
    // user action display class
    //
    // ARRAY INDEX            DESCRIPTION
    // 0                      Name of the module
    // 1                      Privacy
    // 2                      Name of the FaceKoo Element class (application)
    // 3                      Name of the Space Page Component class
    // 4                      Name of the Page class that represents the main page of the module
    // 5                      Name of the Action Display class that represents the display of user actions, notifications, and friends' actions
    //
    // Privacy explanation: 0=private, 1=only between the source and the target, 2=friends, 3=all
    // Time:2008-10-27
    // Author:王照暄

    protected static $modules = array(
    	0 => array('注册与登录',2,'SignApplication', false, false, false,100),
    	1 => array('个人主页',2,'SpaceApplication', false, false, false,100)
    /**
        0 => array('个人资料', 2, 'User', false, false, false,false),
        1 => array('神舟卫星', 3, 'SatelliteApplication', 'SatelliteSpacePageComponent', 'SatellitePage', 'SatelliteActionDisplay',100),
        2 => array('小纸条', 1, 'ScripApplication', false, 'ScripPage',false,100),
        3 => array('打招呼', 1, 'GreetApplication', "GreetSpacePageComponent", 'GreetPage', false,100),
        4 => array("Koo图",3,'PhotoAlbumApplication','PhotoAlbumSpacePageComponent',"PhotoAlbumPage","PhotoAlbumActionDisplay",100),
        5 => array("修改个人资料",3,'ProfileApplication',false,"ProfilePage","ProfileActionDisplay",100),
        6 => array('好友', 3, 'FriendsApplication', 'FriendsSpacePageComponent', 'FriendsPage', 'FriendsActionDisplay',false),
        9 => array('小动作', 3, "UserActionApplication", 'UserActionSpaceComponent', false, false,100),
        10 => array('访问统计', 3, 'VisitApplication', 'WhoVisitMeSpacePageComponent', false, false,200),
        11 => array("搜脸",3,"SearchFaceApplication",false,"SearchFacePage","SearchFaceActionDisplay",100),
        12 => array('好友小动作', 3, false, 'FriendsActionPageComponent', false, false,100),
        13 => array('大事件', 3, false, 'NotificationPageComponent', false, false,100),
        14 => array('大头贴',3,'BigHeadApplication','BigHeadSpacePageComponent','BigHeadPage','BigHeadActionDisplay',100),
        15 => array('留言板',3,'MessageBoardApplication','MessageBoardSpacePageComponent',false,'MessageBoardActionDisplay',300),
        16 => array('日志',3,'DiaryApplication','DiarySpacePageComponent','DiaryPage','DiaryActionDisplay',100),
        17 => array('魔镜',3,"MagicMirrorApplication","MagicMirrorSpacePageComponent","MagicMirrorPage",false,100),
        18 => array('社区',3,"BbsApplication","BbsSpacePageComponent","BbsPage","BbsActionDisplay",false),
        19 => array('手机下载',3,"SPApplication",false,"MMSDownloadPage",false,100),
        20 => array('超级问候语',3,"SuperGreetApplication",false,"SuperGreetPage","SuperGreetActionDisplay",100),
        21 => array('正义TPP',3,"KickGameApplication",false,"KickGamePage","KickGameActionDisplay",100),
        22 => array('轻描淡写',3,"DescribeMeApplication","DescribeMeSpacePageComponent","DescribeMePage","DescribeMeActionDisplay",100),
        23 => array('首页',3,"IndexApplication","GameSpacePageComponent",false,false,100),
        24 => array("无敌大包子",3,"GiftApplication",false,"GiftPage","GiftActionDisplay",100),
        25 => array("软件下载",3,"SoftwareDownloadApplication",false,"SoftwareDownloadPage",false),
        26 => array("KOO彩铃",3,"CL12530Application",false,false,"CL12530ActionDisplay",false),
        27 => array("炫丽五子棋",3,"GobangApplication",false,"GobangPage","GobangActionDisplay",100),
        28 => array("晒柜",3,"ShowCaseApplication","ShowCaseSpaceComponent","ShowCasePage","ShowCaseActionDisplay",100),
        29 => array("搜友",3,"UserSearchFaceApplication",false,"UserSearchFriendPage","UserSearchFriendActionDisplay",100),
        30 => array("礼物",3,"FkGiftApplication","FkGiftReceiveSpacePageComponent","FkGiftPage","FkGiftActionDisplay",100),
        31 => array("付费",3,"PayApplication",false,"PayPage","PayActionDisplay",false),
        32 => array("Speak2me",3,"Speak2meApplication",false,"Speak2mePage","Speak2meActionDisplay",100),
        33 => array("生日",3,false,false,false,"BirthdayActionDisplay",100),
        34 => array("投票",3,"VoteApplication","VoteSpacePageComponent","VotePage","VoteActionDisplay",100),
        35 => array("PK",3,"PkApplication",false,"PkPage","PkActionDisplay",100),
        36 => array("神舟三国",3,"SanGuoApplication","SanguoSpacePageComponent","SanGuoPage","SanGuoActionDisplay",100),
        37 => array("小游戏",3,"FlashGameApplication",false,"FlashGamePage","FlashGameActionDisplay",100),
        38 => array("搜搜",3,"SearchGameApplication",false,"SearchGamePage",false,false),
        39 => array("历史状态",3,"StatusApplication",false,"StatusPage","StatusActionDisplay",100),
        40 => array("视频",3,"VideoApplication","VideoSpacePageComponent","VideoPage","VideoActionDisplay",100),
        41 => array("wii",3,"WiiApplication",false,"WiiPage","WiiActionDisplay",false)
    **/
    );
    public static function getElementObject($id) {
        if (array_key_exists($id, self::$modules)) {
            $module = self::$modules[$id];
            if (class_exists($module[2])) {
                return new $module[2]($id, $module[0], $module[1], $module[6]);
            } else {
                error_log("WZX_website Element Class for ID $id ({$module->name}) does not exist");
            }
        } else {
            error_log("WZX_website Module ID $id does not exist!");
        }
        return false;
    }
    
    public static function getSpacePageComponentObject($id) {        
        if (array_key_exists($id, self::$modules)) {
            $module = self::$modules[$id];
            if (class_exists($module[3])) {
                return new $module[3]($id, $module[0]);
            } else {
                error_log("WZX_website SpacePageComponent Class for ID $id ({$module->name}) does not exist");
            }
        } else {
            error_log("WZX_website Module ID $id does not exist!");
        }
        return false;
    }
    
    public static function getPageObject($id) {
        if (array_key_exists($id, self::$modules)) {
            $module = self::$modules[$id];
            if (class_exists($module[4])) {
                return new $module[4]($id, $module[0]);
            } else {
                error_log("WZX_website Page Class for ID $id ({$module->name}) does not exist");
            }
        } else {
            error_log("WZX_website Module ID $id does not exist!");
        }
        return false;
    }
    
    public static function getActionDisplayObject($id) {
        if (array_key_exists($id, self::$modules)) {
            $module = self::$modules[$id];
            if (class_exists($module[5])) {
                return new $module[5]($id, $module[0]);
            } else {
                error_log("WZX_website ActionDisplay Class for ID $id ({$module->name}) does not exist");
            }
        } else {
            error_log("WZX_website Module ID $id does not exist!");
        }
        return false;
    }

    private function __construct() { 
        error("This class is not supposed to be instantiated"); 
        exit;
    }
}

?>
